Xbasic

Extension::JsonToYaml Method

Syntax

.ToYaml as c (json as C)

Arguments

json

JSON string to convert into YAML.

Description

Create YAML for JSON. YAML is a markup that uses indentation to convey structure, and makes use of ':' as a separator character to denote named items.

Example

dim json as c = <<%json%
{
    "fname": "john",
    "lname": "public",
    "address": {
        "street": "12 and main",
        "city": "Squares Ville",
        "State": "KY"
    }
}
%json%
	dim yaml as c = extension::JSON::ToYaml(json)
	? yaml
fname: john
lname: public
address:
  street: 12 and main
  city: Squares Ville
  State: KY